<?php
/**
 * Created by PhpStorm.
 * User: xmy2
 * Date: 18-9-17
 * Time: 下午3:34
 */

namespace vola;


class Occ
{
    private $allocc = [];

    public function __construct()
    {
    }

    public function add($name, $value = '', $group = '') {
        if (isset($this->allocc[$group][$name])) {
            return false;
        }

        $this->allocc[$group][$name] = $value;
    }

    public function update($name, $value = '', $group = '') {
        if (isset($this->allocc[$group][$name])) {
            $this->allocc[$group][$name] = $value;
        } else {
            $this->add($name, $value, $group);
        }
    }

    public function get($name, $group = '') {
        if (empty($group)) {
            $group = 'sys';
        }

        if (isset($this->allocc[$group][$name])) {
            return $this->allocc[$group][$name];
        }

        return false;
    }

}